home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample CSAM / Sources / SKEL•Util.A < prev   
Encoding:
Text File  |  1995-07-28  |  1.7 KB  |  83 lines  |  [TEXT/MPS ]

  1. *
  2. *    Utility routines for the LDAP DSAM.
  3. *
  4. *        Written by: Gavin Eadie
  5. *                    The University of Michigan Computing Center
  6. *                    535 West William, Ann Arbor, Michigan 48103-4943
  7. *             Phone: (313) 936-0816
  8. *         AppleLink: A67
  9. *          Internet: Gavin.Eadie@umich.edu
  10. *
  11. *        History:    Oct22/91 - Started (Gav)
  12. *                    Sep13/92 - Improved for DSAM etc (Gav)
  13. *                    Apr13/93 - corrected bzero bug ... (Gav)
  14. *
  15.  
  16.         Case     Object
  17.  
  18.         Print    OFF
  19.  
  20.         Include 'Traps.a'
  21.         Include    'SysEqu.a'
  22.  
  23.         Load    'ProgStrucMacs.d'
  24.         Load    'FlowCtlMacs.d'
  25.  
  26.         Print    ON                
  27.  
  28.  
  29. ***********************************************************************
  30. *
  31. *    void io_Complete(CntrlParam *);
  32. *
  33. *        performs the I/O completion handling on an IOP.
  34. *
  35.  
  36. A5_Save    EQU         18                     ; offset to saved A5 in PB
  37.  
  38. Export    Procedure io_Complete(PB:L,Err:L),C,LINK=DEBUG
  39.         
  40.         Begin    Save=D0-D1/A0-A1
  41.  
  42.         Move.L    PB(FP),A0                ; get PB
  43.         Move.L    Err(FP),D0                ; get Err
  44.  
  45.         Move.W    D0,ioResult(A0)            ; set ioResult in PB
  46.         Move.L    ioCompletion(A0),D1        ; check if I/O completion routine
  47.         If# NZ Then.S
  48.             Move.L    A5,-(SP)            ; save it for the duration
  49.             Move.L    A5_Save(A0),A5
  50.             Link    A6,#0                ; make a stack frame
  51.             Move.L    A0,-(SP)            ; push PB for C call
  52.             Move.L    D1,A1
  53.             Tst.W    D0                    ; clear zero condition flag
  54.             Jsr        (A1)                ; call completion routine
  55.             Unlk    A6                    ; clean out the stack
  56.             Move.L    (SP)+,A5
  57.         EndIf#
  58.  
  59.         Return
  60.  
  61.  
  62. ***********************************************************************
  63. *
  64. *    void bzero(void * , long);
  65. *
  66. *        Clear a block of memory.
  67. *
  68.  
  69. Export    Procedure bzero(ptr:L, len:L),C,LINK=DEBUG
  70.         
  71.         Begin
  72.  
  73.         Move.L    ptr(FP),A0                ; pointer to target region
  74.         Move.L    len(FP),D0                ; and its length in bytes
  75.         Bra.S    @20
  76.         
  77. @10        Clr.B    (A0)+                    ; clear a byte
  78. @20        Dbra    D0, @10
  79.  
  80.         Return
  81.  
  82.     End
  83.